<!DOCTYPE html>
<html>
<head>
	<title>Add/delete data on runtime</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<link rel="stylesheet" type="text/css" href="../common/demo_style.css"/>
	<script>
		var myList;
		function doOnLoad() {
			myList = new dhtmlXList({
				container:"data_container",
				template:"<span class='dhx_strong'>#name#</span>#address# <br/><span class='dhx_light'>#city#</span>",
				type:{ height:80 }
			});
			myList.load("../common/list.xml");
		}
		function add_data(argument) {
			myList.add({
				name: document.getElementById("n_name").value,
				address: document.getElementById("a_name").value,
				city: document.getElementById("c_name").value
			},0)
		}
		function remove_data(){
			myList.remove(myList.getSelected());
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h1>Add/delete data on runtime</h1>
	<form style="width:212px">
		Name <input type="text" id="n_name" value="John Doe"><br>
		Address <input type="text" id="a_name" value="15 Long Street"><br>
		City <input type="text" id="c_name" value="Smalltown"><br>
		<input type="button" value="Add &rarr;" onclick='add_data()'>
		<hr>
		<input type="button" value="Remove selected &rarr;" onclick='remove_data()'>
	</form>
	<div id="data_container" class="list_demo_samples"></div>
</body>
</html>
